package com.example.demo.controller;

import com.example.demo.model.DbTypes;
import com.example.demo.model.Person;
import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseStatus;

@Controller
public class YmlController {
    @Value("${int.value}")
    private int value;

    @Autowired
    private Person person;

    // 也可以直接读取person对象中的值
    @Value("${person.name}")
    private String name;

    @Autowired
    private DbTypes dbTypes;


    // 这个注解表示在构造这个类的时候执行这个方法
    @PostConstruct
    public void init(){
        System.out.println(value);
        System.out.println(person);
        System.out.println(name);
        System.out.println(dbTypes);
    }
}
